﻿using System;
using System.Data;
using System.Data.SqlClient;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace ThienLoc
{
    public partial class UCContent : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            LoadContent();
        }

        private void LoadContent()
        {
            string sql = "SELECT * FROM dbo.tblTLMenu";
            DataTable dt = SqlHelper.ExecuteDataTable(CommandType.Text, sql);
            UCMenuItemBlock block;
            foreach (DataRow item in dt.Rows)
            {
                block = (UCMenuItemBlock)LoadControl("UCMenuItemBlock.ascx");
                block.SetValue(Convert.ToInt32(item["ID"]), item["Ten"].ToString(), item["Image"].ToString());
                PlaceHolder1.Controls.Add(block);
                block = null;
            }
        }
    }
}